﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NKD07
{
    public partial class Site : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Authenticate"].ToString() == "Yes")
            {
                lblUsername.Text = "Hello " + Session["User"].ToString() + "(You are in " + Session["Role"].ToString() + " role )";
            }
            else
            {
                //Response.Redirect("~/login.aspx");
            }

            loadCategiries();
        }

        // load all categories from database 
        private void loadCategiries()
        {
            Classes.category category = new Classes.category();
            DataTable categories  = category.getAllCategories();
            idCategories.DataSource = categories;
            idCategories.DataBind();
        }
    }
}